<template>
    <div class="page-header">
        <div class="header-content">
            <button class="back-btn" @click="handleBack">
                <van-icon name="arrow-left" size="20" />
            </button>
            <h2>{{ title }}</h2>
        </div>
    </div>
</template>

<script setup>
import { Icon as VanIcon } from 'vant';
import { router } from '@inertiajs/vue3';
import RouterPath from '@/constans/RouterPath.js';

const props = defineProps({
    title: {
        type: String,
        required: true
    },
    backPath: {
        type: String,
        default: RouterPath.users.home
    }
});

const handleBack = () => {
    router.visit(props.backPath);
};
</script>

<style scoped>
.page-header {
    background: white;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 800px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover {
    background: #e8e8e8;
    transform: scale(1.05);
}

.header-content h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
    font-weight: 500;
}
</style> 